cmake_minimum_required(VERSION 2.8)
project(libbperrtc)

add_definitions(-D__STDC_FORMAT_MACROS)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -std=gnu11 ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -std=gnu++11 ")
set(HOME_BASE_REL "../")
get_filename_component(HOME_BASE ${HOME_BASE_REL} REALPATH)
#set(BPer_3RD_DIR ${HOME_BASE}/thirdparty/lib/android/${CMAKE_ANDROID_ARCH_ABI})
#set(BPer_Lib_DIR ${HOME_BASE}/bin/lib_android/${CMAKE_ANDROID_ARCH_ABI})
# 头文件目录
include_directories(${HOME_BASE}/include)
include_directories(${HOME_BASE}/thirdparty/include)
include_directories(${HOME_BASE}/thirdparty/user_include)
include_directories(${HOME_BASE}/thirdparty/user_include/ffmpeg)
include_directories(${HOME_BASE}/libbperrtc/src)
#set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if (NOT NoCapture)
# 发现目录下的源文件
aux_source_directory(./src/bperaudiodev DIR_SRCS)
aux_source_directory(./src/bpercapture DIR_SRCS)
aux_source_directory(./src/bperencoder DIR_SRCS)
aux_source_directory(./src/bperdecoder DIR_SRCS)
aux_source_directory(./src/bperpush DIR_SRCS)
endif()

aux_source_directory(./src/bperutil DIR_SRCS)
aux_source_directory(./src/bperutil/buffer DIR_SRCS)
aux_source_directory(./src/bperavutil DIR_SRCS)
aux_source_directory(./src/bperstream DIR_SRCS)

if (NOT NoPlayer)
aux_source_directory(./src/bperplayer DIR_SRCS)
endif()
aux_source_directory(./src/bperp2p DIR_SRCS)
aux_source_directory(./src/bperrtc DIR_SRCS)
if ((CMAKE_SYSTEM_NAME MATCHES "Windows") OR (CMAKE_SYSTEM_NAME MATCHES "Linux"))
aux_source_directory(./src/bperdecoder/pc DIR_SRCS)
aux_source_directory(./src/bpersrt DIR_SRCS)
aux_source_directory(./src/bperrecord DIR_SRCS)
aux_source_directory(./src/bperutil/sys DIR_SRCS)
endif()

if (NOT NoCapture)
	aux_source_directory(./src/bperp2p2 DIR_SRCS)
	if (CMAKE_SYSTEM_NAME MATCHES "Windows")
	aux_source_directory(./src/bperaudiodev/win DIR_SRCS)
	aux_source_directory(./src/bpercapture/win DIR_SRCS)
	elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
	aux_source_directory(./src/bperaudiodev/linux DIR_SRCS)
	aux_source_directory(./src/bpercapture/linux DIR_SRCS)
	elseif(APPLE)
	aux_source_directory(./src/bperaudiodev/mac DIR_SRCS)
	aux_source_directory(./src/bpercapture/mac DIR_SRCS)
	else()
	aux_source_directory(./src/bperaudiodev/android DIR_SRCS)
	aux_source_directory(./src/bpercapture/android DIR_SRCS)
	aux_source_directory(./src/bperandroid DIR_SRCS)
	endif()
endif()



include(utils.cmake)
# 排除不参与编译的文件
add_library(bperrtc ${DIR_SRCS})
#if ((CMAKE_SYSTEM_NAME MATCHES "Windows") OR (CMAKE_SYSTEM_NAME MATCHES "Linux"))
#add_library(bperrtc5 ${DIR_SRCS})
#else()
#set(opengl-bilGLESv3)
#add_library(bperrtc3 ${DIR_SRCS})
#target_link_libraries( # Specifies the target library.
#       bperrtc5
#        ${BPer_Lib_DIR}/libbperrtccore3.a
#       ${BPer_3RD_DIR}/libsrtp2.a ${BPer_3RD_DIR}/libssl.a ${BPer_3RD_DIR}/libcrypto.a
#        ${BPer_3RD_DIR}/libspeexdsp.a ${BPer_3RD_DIR}/libyuv.a
#        ${BPer_3RD_DIR}/libBPerh264decoder.a ${BPer_3RD_DIR}/libopus.a
#        # Links the target library to the log library
        # included in the NDK.
#        EGL GLESv3 android log)

#endif()


